<?php
//更新员工信息
require_once('../config.php');

    $name = $_POST['name'];
    $address = $_POST['address'];
    $salary = $_POST['salary'];
    $gender = $_POST['gender'];

    $id = $_POST['id'];

    $sql = "UPDATE `employees` set `name` = '{$name}', `address` = '{$address}',`$salary` = '{$salary}', `gender` = '{$gender}' where id = '{$id}'";
    $result = $link->query($sql);

	if($result){
    $resp['status'] = 'success';
	}else{
		$resp['status'] = 'failed';
		$resp['msg'] = 'An error occured while saving the data. Error: '.$link->error;
	}
    echo json_encode($resp);

?>